<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%@ include file="common.jsp" %>
<%            // Main Application Logic Comes Here

%>

<HTML>
    <c:set var="title" value="MIC Tycoon ~ Project Page"/>
    <%@ include file="htmlheader.jsp" %>

    <body>
        <div id="resolution">

            <%@ include file="header.jsp" %>
            <%@ include file="menu.jsp" %>

            <div class="content">

                <!-- COMPANY/SYSTEM GENERATED PROJECTS -->

                <div id="bid_project">

                    <img src="<%= realURL("", url)%>images/titles/bid-proj.png" border="0" /><br/>

                    <c:forEach items="${project_list}" var="project">
                        <!-- BID PROJECT -->
                        <div id="bid-paper-holder">

                            <div id="deadline-holder">${project.due_turn}</div>

                            <div id="paper-content">
                                [<b>#${project.project_id}</b>] ${project.company.name}
                                <br/>
                                <b>Max Bid:</b> ${project.max_bid_string}
                                <!--<hr /><b>Required Man Hours:</b>-->
                            </div>

                            <div id="paper-manhour">
                                <c:if test="${project.man_hours_dot_net ==0}"><div id="hour-off">&nbsp;</div></c:if>
                                <c:if test="${project.man_hours_dot_net !=0}"><div id="hour-on">${project.man_hours_dot_net}</div></c:if>
                                <c:if test="${project.man_hours_c_sharp ==0}"><div id="hour-off">&nbsp;</div></c:if>
                                <c:if test="${project.man_hours_c_sharp !=0}"><div id="hour-on">${project.man_hours_c_sharp}</div></c:if>
                                <c:if test="${project.man_hours_jsp ==0}"><div id="hour-off">&nbsp;</div></c:if>
                                <c:if test="${project.man_hours_jsp !=0}"><div id="hour-on">${project.man_hours_jsp}</div></c:if>
                                <c:if test="${project.man_hours_php ==0}"><div id="hour-off">&nbsp;</div></c:if>
                                <c:if test="${project.man_hours_php !=0}"><div id="hour-on">${project.man_hours_php}</div></c:if>
                                <c:if test="${project.man_hours_ruby ==0}"><div id="hour-off">&nbsp;</div></c:if>
                                <c:if test="${project.man_hours_ruby !=0}"><div id="hour-on">${project.man_hours_ruby}</div></c:if>
                                <c:if test="${project.man_hours_mysql ==0}"><div id="hour-off">&nbsp;</div></c:if>
                                <c:if test="${project.man_hours_mysql !=0}"><div id="hour-on">${project.man_hours_mysql}</div></c:if>
                                <c:if test="${project.man_hours_mssql ==0}"><div id="hour-off">&nbsp;</div></c:if>
                                <c:if test="${project.man_hours_mssql !=0}"><div id="hour-on">${project.man_hours_mssql}</div></c:if>
                                <c:if test="${project.man_hours_oracle ==0}"><div id="hour-off">&nbsp;</div></c:if>
                                <c:if test="${project.man_hours_oracle !=0}"><div id="hour-on">${project.man_hours_oracle}</div></c:if>
                            </div>

                            <div id="paper-action">
                                <c:set var="form_action" value="./${project.project_id}/bid"/>
                                <c:set var="bid_value" value="0" />
                                <c:set var="has_bid" value="false" />
                                <c:set var="submit_text" value="bid!"/>

                                <c:forEach items="${player_bid_list}" var="bid">
                                    <c:choose>
                                        <c:when test="${bid.project_id == project.project_id}">
                                            <c:set var="form_action" value="./${project.project_id}/editBid"/>
                                            <c:set var="bid_value" value="${bid.amount}" />
                                            <c:set var="has_bid" value="true" />
                                            <c:set var="submit_text" value="edit!"/>
                                        </c:when>
                                    </c:choose>
                                </c:forEach>

                                <form action="${form_action}" method="POST">
                                    <input type="hidden" name="project_id" value="${project.project_id}"/>
                                    <b>Your Bid:</b>
                                    <input type="textbox" name="${project.project_id}" class="enter-amt" value="${bid_value}"/>
                                    <br/>
                                    <c:if test="${has_bid == true}">
                                        <a href="./${project.project_id}/removeBid">
                                            <input type="button" value="cancel"/></a>

                                    </c:if>
                                    <input type="submit" value="${submit_text}">
                                </form>
                            </div>

                        </div>
                    </c:forEach>
                </div>


                <!-- OUTSOURCE PROJECTS -->

                <div id="bid_outsource_project">
                    <img src="<%= realURL("", url)%>images/titles/buy-proj.png" border="0" /><br/>

                    <c:forEach items="${outsource_project_list}" var="project">
                        <c:if test="${project.creator.player_id != player.player_id}">
                            <!-- BID PROJECT -->
                            <div id="buy-paper-holder">

                                <div id="deadline-holder">${project.due_turn}</div>

                                <div id="paper-content">
                                    [<b>#${project.project_id}</b>] ${project.creator.company_name}
                                    <br/> <b>Max Bid:</b> ${project.max_bid}
                                </div>

                                <div id="paper-manhour">
                                    <c:if test="${project.man_hours_dot_net ==0}"><div id="hour-off">&nbsp;</div></c:if>
                                    <c:if test="${project.man_hours_dot_net !=0}"><div id="hour-on">${project.man_hours_dot_net}</div></c:if>
                                    <c:if test="${project.man_hours_c_sharp ==0}"><div id="hour-off">&nbsp;</div></c:if>
                                    <c:if test="${project.man_hours_c_sharp !=0}"><div id="hour-on">${project.man_hours_c_sharp}</div></c:if>
                                    <c:if test="${project.man_hours_jsp ==0}"><div id="hour-off">&nbsp;</div></c:if>
                                    <c:if test="${project.man_hours_jsp !=0}"><div id="hour-on">${project.man_hours_jsp}</div></c:if>
                                    <c:if test="${project.man_hours_php ==0}"><div id="hour-off">&nbsp;</div></c:if>
                                    <c:if test="${project.man_hours_php !=0}"><div id="hour-on">${project.man_hours_php}</div></c:if>
                                    <c:if test="${project.man_hours_ruby ==0}"><div id="hour-off">&nbsp;</div></c:if>
                                    <c:if test="${project.man_hours_ruby !=0}"><div id="hour-on">${project.man_hours_ruby}</div></c:if>
                                    <c:if test="${project.man_hours_mysql ==0}"><div id="hour-off">&nbsp;</div></c:if>
                                    <c:if test="${project.man_hours_mysql !=0}"><div id="hour-on">${project.man_hours_mysql}</div></c:if>
                                    <c:if test="${project.man_hours_mssql ==0}"><div id="hour-off">&nbsp;</div></c:if>
                                    <c:if test="${project.man_hours_mssql !=0}"><div id="hour-on">${project.man_hours_mssql}</div></c:if>
                                    <c:if test="${project.man_hours_oracle ==0}"><div id="hour-off">&nbsp;</div></c:if>
                                    <c:if test="${project.man_hours_oracle !=0}"><div id="hour-on">${project.man_hours_oracle}</div></c:if>
                                </div>

                                <div id="paper-action">
                                    <form action="./${project.project_id}/bid" method="POST">
                                        <input type="hidden" name="project_id" value="${project.project_id}"/>
                                        <input type="hidden" name="parent_id" value="${project.parent_id}" />
                                        <b>Payout:</b> ${project.bidded_price_string}
                                        <br/>
                                        <input type="submit" value="Buy!">
                                    </form>
                                </div>

                            </div>
                        </c:if>
                    </c:forEach>
                </div>
            </div>
        </div>
    </BODY>
</HTML>
